/**
 * 
 */
package com.greenx.hello.String;

import java.util.ArrayList;
import java.util.List;

import com.greenx.hello.hEnum.ELanugageID;

/**
 * @author StephenXianweiZhang
 * 
 */
public class HelloString {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ELanugageID[] ids=ELanugageID.values();
		System.out.println(ids[1]);
		//tEqual();
		// tSpilt();
		// t4Location();

	}
	
	private static void tEqual(){
		System.out.println("en123".equalsIgnoreCase("en"));
	}

	private static void tIndexOf() {
		final String languagesSupported = "|EN|FR|ES|DE|IT";
		System.out.println(languagesSupported.indexOf("en".toUpperCase()));
	}

	private static void tSS() {
		String str = "fix_question_1";
		System.out.println("ID:"
				+ str.substring(str.lastIndexOf("_") + 1, str.length()));

	}

	private static void tSpilt() {
		String str = "ssoid=[CWT]STEPHENZHANG&tmpPassword=19235409&langId=1";
		for (String s : str.split("&")) {
			System.out.println(" str: " + s);
			if (s.indexOf("ssoid=") == 0) {
				System.out.println(s.substring(s.indexOf("[CWT]") + 5));
			}
		}

	}

	private static void tIndex() {
		String str = "https://sso.qa.carlsonwagonlit.com/forgotPassword.do";
		System.out.println(" loc: " + str.indexOf("/forgotPassword.do"));
		System.out.println(" str: "
				+ str.substring(0, str.indexOf("/forgotPassword.do")));
	}

	private static void t4Location() {
		String locDB = "iphone=cwttogolaunch://authorize/#android=http://www.cwttogo.com";
		String locFromDB = "iphone=cwttogolaunch://forgotPassword/#android=http://www.cwttogo.com/forgotPassword";
		String loc = "";
		String key = "iphone";
		String[] locArray = locDB.split("#");
		for (int i = 0; i < locArray.length; i++) {
			if (locArray[i].indexOf(key) >= 0) {
				loc = locArray[i].substring(locArray[i].indexOf("=") + 1);
			}
		}
		System.out.println(" loc: " + loc);
	}

	private static void t3Cases() {
		String str = "30 days PP admin";
		System.out.println(" str: " + str);
		System.out.println(" str: " + str.toLowerCase().toLowerCase());
	}

	private static void t2() {
		String str = "30 days PP admin";
		System.out.println(" str: " + str + "|" + str.indexOf(30) + "|"
				+ str.substring(0, 3));
		int days = Integer.parseInt(str.substring(0, 3).trim());
		System.out.println(" days: " + days);
	}

	private static void tSB() {
		StringBuffer sb = new StringBuffer("");
		sb.append("current time:Mon Jan 21 13:22:26 CST 2013  :startTimeMs:1358745746291\n");
		sb.append("current time:Mon Jan 21 13:22:26 CST 2013 :taskTimeS:0");
		System.out.println(" sb: " + sb.toString());
	}

	private static void t3() {
		String str = "Help Desk Plus";
		final String passPolicyExpireDay = 75 + "";
		int expireDays = Integer.parseInt(passPolicyExpireDay);
		System.out.println(" expireDays:" + expireDays);
		switch (expireDays) {
		case 30:
			System.out.println(" iAdministrativeGroup30");
			return;
		case 45:
			System.out.println(" iAdministrativeGroup45");
			return;
		case 60:
			System.out.println(" iAdministrativeGroup60");
			return;
		case 75:
			System.out.println(" iAdministrativeGroup75");
			return;
		case 90:
			System.out.println(" iAdministrativeGroup90");
			return;
		case 120:
			System.out.println(" iAdministrativeGroup120");
			return;
		}

		System.out.println(" str: " + str.indexOf("Help Desk "));

	}

	private static void t() {

		String tips = "Your password will |expire| in $daysToExpire days. Please update your password now or <a href=\"$continueURL\">continue</a> to Sign In without updating your password at this time.";
		if (tips != null && tips.length() > 0) {
			Integer daysToExpire = 3;
			if (daysToExpire == null) {
				daysToExpire = 0;
			}
			String continueURL = "post.do";
			if (tips.indexOf("$continueURL") > 0) {
				tips = tips.replace("$continueURL", continueURL);
			}
			if (tips.indexOf("$daysToExpire") > 0) {
				tips = tips.replace("$daysToExpire", daysToExpire + "");
			}
			if (tips.indexOf("|expire|") > 0) {
				tips = tips
						.replace("|expire|",
								"<font style=\"color: #0098A1;font-weight: bold\">expire</font>");
			}

			if (tips.indexOf("|expired|") > 0) {
				tips = tips
						.replace("|daysToExpire|",
								"<font style=\"color: #0098A1;font-weight: bold\">expired</font>");
			}

		}
		// if(tips.indexOf("|expire|")>0){
		// tips=tips.replace("|expire|",
		// "<font style="+"color: #0098A1;font-weight: bold"+">expire</font>");
		// }
		// System.out.println(tips);
		// if(tips.indexOf("|daysToExpire|")>0){
		// tips=tips.replace("|daysToExpire|",
		// "<font style="+"color: #0098A1;font-weight: bold"+">expired</font>");
		// }
		// System.out.println(tips);
		//
		// if(tips.indexOf("|continueURL|")>0){
		// tips=tips.replace("|continueURL|",
		// "<font style="+"color: #0098A1;font-weight: bold"+">continueURL</font>");
		// }
		// System.out.println(tips);
		//
		// if(tips.indexOf("$daysToExpire")>0){
		// tips=tips.replace("$daysToExpire","daysToExpireT");
		// }
		System.out.println(tips);

		tips = "Your Password has |expired| - please enter a new one";
		if (tips.indexOf("|expired|") > 0) {
			tips = tips
					.replace("|expired|",
							"<font style=\"color: #0098A1;font-weight: bold\">expired</font>");
		}
		System.out.println(tips);

	}

	private static void testReplace() {

		String str = "Your password will expire in $daysToExpire day. Please update your password now or <a href="
				+ "$continueURL"
				+ ">continue</a> to Sign On without updating your password at this time.";
		System.out.println(" str: index of daysToExpire: "
				+ str.indexOf("daysToExpire"));
		System.out.println(" str: " + str);
		str = str.replaceAll("\\$daysToExpire", "1");
		str = str.replaceAll("\\$continueURL", "/postAuth.do");
		System.out.println(" str: " + str);
	}

	private static void testNull() {
		String str = (String) null;
		System.out.println(" str: " + str);
		str = "abc";
		System.out.println(" str: " + str);
	}

	private static void testJsp(String passwordExpiredValue) {
		if ("0".equals(passwordExpiredValue)) {
			System.out.println("Never Expire");
		} else if ("30".equals(passwordExpiredValue)) {
			System.out.println("30 Days");
		} else if ("45".equals(passwordExpiredValue)) {
			System.out.println("45 Days ");
		} else if ("60".equals(passwordExpiredValue)) {
			System.out.println("60 Days ");
		} else if ("90".equals(passwordExpiredValue)) {
			System.out.println("90 Days ");
		} else if ("120".equals(passwordExpiredValue)) {
			System.out.println("120 Days ");
		}
	}

	private static void testReplace(String str) {

		System.out.println(" str: " + str);

		System.out.println(" str: " + str.substring(0, str.lastIndexOf(',')));
	}

	private static void testStringBuffer() {
		List<String> orgsIDList = new ArrayList<String>();
		orgsIDList.add("2393937");
		orgsIDList.add("2393940");
		StringBuffer orgsIDSB = new StringBuffer("");
		if (orgsIDList != null && orgsIDList.size() > 1) {
			for (String orgIDTmp : orgsIDList) {
				if (!orgIDTmp.equals("2393937")) {
					orgsIDSB.append(orgIDTmp + ",");
				}
			}
		}
		System.out.println(orgsIDSB.substring(0, orgsIDSB.lastIndexOf(",")));
	}

	private static void testStrEqual() {
		String str1 = "2393937";
		String str2 = "2393937";

		System.out.println("str1: " + str1 + " and str2:" + str2 + " is same:"
				+ str1.equals(str2));

	}

	private static void testStringToArray() {
		String str = "1302, 1301, 1435120, 1435420, 1435520, 1445020, 1445023, 1445026, 1445029, 1445032, 1446420, 1446428, 1446520, 1447520, 1448222, 1448227, 1448230, 1448239, 1448242, 1448245, 1448248, 1448251, 1448254, 1448257, 1448260, 1448263, 1448266, 1448269, 1448272, 1448275, 1448278, 1448281, 1448284, 1448287, 1448290, 1448293, 1448296, 1448299, 1448302, 1448305, 1448308, 1448311, 1448314, 1448317, 1448320, 1448323, 1448326, 1448329, 1448332, 1448335, 1448338, 1448341, 1448344, 1448347, 1448350, 1448353, 1448356, 1448359, 1448362, 1448365, 1448368, 1449286, 1452427, 1452528, 1452546, 1452581, 1453756, 1453777, 1454120, 1454123, 1454127, 1454130, 1454136, 1454139, 1454142, 1454145, 1454148, 1454151, 1454154, 1454525, 1454632, 1455061, 1455985, 1455988, 1455994, 1456425, 1456726, 1456732, 1457635, 1458239, 1458434, 1458446, 1459427, 1460037, 1460224, 1460780, 1460972, 1460980, 1462607, 2156215, 2300745, 2301018, 2301021, 2301027, 2303042, 2307621, 2307624, 2307627, 2307630, 2307633, 2307636, 2307644, 2307647, 2307650, 2307653, 2307656, 2307659, 2307721, 2307724, 2307727, 2307730, 2307733, 2307755, 2308625, 2308631, 2308920, 2309120, 2309126, 2309133, 2309148, 2309420, 2310130, 2310133, 2311120, 2312820, 2315547, 2317144, 2317174, 2317205, 2317738, 2318060, 2318081, 2318108, 2318326, 2318384, 2320721, 2322824, 2334465, 2337155, 2337343, 2337359, 2338426, 2338786, 2339726, 2340783, 2345271, 2359146, 2359152, 2359200, 2371135, 2377465, 2382122, 2382821, 2383824, 2385174, 2385334, 2385346, 2385434, 2385443, 2385461, 2385469, 2386225, 2386228, 2386241, 2386249, 2391331, 2391408, 2392524, 2393934, 2396620, 2396868, 2396871, 2396874, 2396877, 2397634, 2398333, 2398568, 2399289, 2399384, 2399519, 2399535, 2399731, 2399749, 2399752, 2399755, 2400375, 2400393, 2400773, 2402836, 2406120, 2406442, 2406463, 2406474, 2406477, 2406826, 2408231, 2408328, 2409931, 2410420, 2231623, 2232020, 2232057, 2232064, 2234521, 2234524, 2234569, 2235261, 2235264, 1435122, 1435421, 1435424, 1445035, 1445038, 1447620, 1447720, 1447820, 1449426, 1448236, 1448233, 1448410, 1448419, 1448425, 1448563, 1448887, 1448893, 1448920, 1448968, 1449007, 1448599, 1448560, 1448566, 1448572, 1448761, 1448767, 1448857, 1448956, 1448986, 1448878, 1449001, 1448638, 1448542, 1448503, 1448524, 1448530, 1448923, 1448941, 1448977, 1449028, 1448470, 1448725, 1448863, 1448872, 1448635, 1448701, 1448713, 1448788, 1448800, 1448995, 1448509, 1448650, 1448665, 1448791, 1448797, 1448899, 1448743, 1448746, 1448773, 1448377, 1448389, 1448443, 1448497, 1448539, 1448545, 1448482, 1448488, 1448644, 1448671, 1448674, 1448686, 1448695, 1448698, 1448710, 1448719, 1448728, 1448911, 1448938, 1448950, 1448824, 1448896, 1448902, 1449013, 1448380, 1448392, 1448395, 1448437, 1448515, 1448593, 1448506, 1448512, 1448602, 1448980, 1448929, 1449019, 1449046, 2382829, 1448374, 1448401, 1448431, 1448569, 1448575, 1448656, 1448755, 1448785, 1448806, 1448890, 1448440, 1448707, 1448839, 1449022, 1448434, 1448677, 1448692, 1448731, 1448749, 1448827, 1448851, 1448812, 1448818, 1448416, 1448581, 1448617, 1448476, 1448740, 1448764, 1448854, 1449004, 1448491, 1448518, 1448971, 1448803, 1448653, 1448782, 1448830, 1448776, 1448404, 1448458, 1448383, 1448500, 1448485, 1448533, 1448548, 1448623, 1448737, 1448770, 1448551, 1448629, 2336227, 1448386, 1448413, 1448494, 1448734, 1448836, 1448842, 1448848, 1448422, 2356843, 1448917, 1448860, 1448884, 1448398, 1448428, 1448452, 1448407, 1448461, 1448467, 1448473, 1448536, 1448632, 1448668, 1448704, 1448716, 1448926, 1448998, 1448983, 1448989, 1449010, 1449025, 1449037, 1448464, 1448659, 1448881, 1448905, 1448947, 1448371, 1448641, 1448647, 1448683, 1448779, 1448809, 1448821, 1448845, 1448875, 1448944, 1448962, 1448752, 1448758, 1448794, 1448866, 1448908, 1448935, 1449016, 1449034, 1449043, 1448914, 1448953, 1448455, 1448479, 1448521, 1448527, 1448557, 1448554, 1448689, 1448974, 1448959, 1448620, 1448449, 1448605, 1448584, 1448590, 1448626, 1448833, 1448869, 1448446, 1448992, 1448578, 1448608, 1448662, 1448815, 1448932, 1448587, 1448611, 1448596, 1448614, 1448680, 1448722, 1449031, 1449040, 1448965, 1449289, 1452430, 1452531, 1452549, 1452593, 1452608, 1453762, 1453759, 1460221, 1454641, 1454644, 1457045, 1457048, 1457051, 1457057, 1457063, 1457068, 1457071, 1457054, 1457060, 1456729, 1456428, 1457638, 1454133, 1458242, 1462610, 2156218, 2232028, 2235029, 2232069, 2234572, 2235267, 2301020, 2301019, 2301023, 2301025, 2301026, 2301022, 2301024, 2301031, 2301028, 2301029, 2301030, 2307921, 2308628, 2308924, 2309123, 2309130, 2337162, 2334833, 2362251, 2309921, 2336827, 2336832, 2337165, 2310140, 2386237, 2336330, 2310136, 2336854, 2336857, 2336861, 2315550, 2371526, 2362124, 2317177, 2317208, 2317741, 2317744, 2318072, 2318084, 2318218, 2318113, 2318221, 2318225, 2318329, 2318389, 2318395, 2318398, 2318401, 2318404, 2318392, 2320726, 2320732, 2320735, 2337362, 2338429, 2338444, 2340775, 2339729, 2345274, 2362068, 2360325, 2371938, 2376477, 2359149, 2360334, 2369473, 2371943, 2359155, 2362420, 2371138, 2375954, 2371472, 2377893, 2377896, 2377902, 2377905, 2377908, 2377890, 2377624, 2377468, 2377875, 2377878, 2377881, 2377884, 2377887, 2377660, 2377675, 2377651, 2377899, 2382134, 2382329, 2382125, 2382128, 2382131, 2382137, 2382320, 2382826, 2385177, 2385337, 2385349, 2385457, 2385447, 2385464, 2385472, 2385475, 2386231, 2386234, 2386244, 2386252, 2391411, 2393937, 2396624, 2396881, 2396884, 2396887, 2396890, 2399759, 2397637, 2398336, 2398439, 2398351, 2398574, 2398571, 2399313, 2399292, 2399408, 2399420, 2399402, 2399411, 2399414, 2399387, 2399405, 2399417, 2399538, 2399541, 2399734, 2400378, 2400396, 2402839, 2406123, 2406445, 2406448, 2406480, 2406483, 2406829, 2408331, 2408334, 2409934, 2410423, 1443620, 1443820, 1444420, 1443720, 1443920, 1446320, 1452127, 1451826, 2393940, 1447020, 1447220, 1446523, 1446720, 1446820, 1447120, 1447320";

		String[] strArray = str.split(",");

		System.out.println(strArray.length);

	}

}
